package com.globallogic.oopbasics.competence.entity;

/**
 * @author olena.strelchuk
 */

/**
 * Specialist Profile is inherited from Speciality Profile and extends its
 * functionality for each specialist
 */
public class SpecialistProfile {

	private Specialist specialist;
	private SpecialityProfile specialityProfile;
	private CompetencyValue[] competencyValues;

	public Specialist getSpecialist() {
		return this.specialist;
	}

	public SpecialistProfile(Specialist specialist,
			SpecialityProfile specialityProfile,
			CompetencyValue[] competencyValues) {
		this.specialist = specialist;
		this.specialityProfile = specialityProfile;
		this.competencyValues = competencyValues;
	}

	/**
	 * toString Method for Specialist Profile
	 * 
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		String result = specialist.toString() + "\n";
		for (int i = 0; i < competencyValues.length; i++) {
			result += competencyValues[i].toString() + "\n";
		}
		result += "---------------------------------------\n";
		return (result + "Total Competence for Speciality "
				+ specialityProfile.getSpeciality().getName()
				+ " has a Value: " + getTotalCompetencyValue() + "\n");
	}

	public SpecialityProfile getSpecialityProfile() {
		return specialityProfile;
	}

	public void setSpecialityProfile(SpecialityProfile specialityProfile) {
		this.specialityProfile = specialityProfile;
	}

	public CompetencyValue[] getCompetencyValues() {
		return competencyValues;
	}

	public void setCompetencyValues(CompetencyValue[] competencyValues) {
		this.competencyValues = competencyValues;
	}

	public double getTotalCompetencyValue() {
		double result = 0;
		for (int i = 0; i < competencyValues.length; i++) {
			result += competencyValues[i].getTotalValue();
		}
		return result;
	}
}
